package com.lc.zpyh.ui.activity.supermarket;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lc.zpyh.R;
import com.lc.zpyh.app.AppActivity;
import com.lc.zpyh.http.glide.GlideApp;
import com.lc.zpyh.other.IntentKey;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

public class DangAnActivity extends AppActivity {
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;
    private BaseQuickAdapter<String, BaseViewHolder> pingjiaadapter;
    List<String> dataBeanList = new ArrayList<>();
    @Override
    protected int getLayoutId() {
        return R.layout.activity_dangan;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        dataBeanList = (List<String>) getIntent().getSerializableExtra("list");
        pingjia();
    }
    private void pingjia() {

        pingjiaadapter = new BaseQuickAdapter<String, BaseViewHolder>
                (R.layout.item_dangan, dataBeanList) {

            @Override
            protected void convert(BaseViewHolder baseViewHolder, String dataBean) {
                ImageView imageView=baseViewHolder.getView(R.id.img);
                GlideApp.with(getActivity())
                        .load(IntentKey.CAR_IMAGE+dataBean)
                        .placeholder(R.mipmap.zhanweiicon01)
                        .error(R.mipmap.zhanweiicon01)

                        .into(imageView);
            }
        };

        View emptyview = View.inflate(getContext(), R.layout.empty_emptylayout, null);

        pingjiaadapter.setEmptyView(emptyview);
        recyclerView.setAdapter(pingjiaadapter);
    }

}
